// app/home-detail/index.tsx
import React, { useLayoutEffect } from 'react';
import { View, Text, StyleSheet, Button } from 'react-native';
import CustomHeader from '@/components/CustomHeader';
const HomeDetail = ({ navigation }) => {
    // 使用 useLayoutEffect 来设置导航栏选项
    useLayoutEffect(() => {
        navigation.setOptions({
            // title: '商品详情', // 设置导航栏标题
            // headerTitleAlign: 'center',
            // headerStyle: {
            //     backgroundColor: '#f4511e', // 设置导航栏背景颜色
            //     textAlign: 'center'
            // },
            // headerTintColor: '#fff', // 设置标题颜色
            // headerTitleStyle: {
            //     fontWeight: 'bold', // 设置标题字体样式
            // },
            header: () => <CustomHeader onBackPress={() => navigation.goBack()} title='商品详情'></CustomHeader>
        });
    }, [navigation]);

    return (
        <View style={styles.container}>
            <Text style={styles.title}>Home Detail Page</Text>
            <Button title="返回" onPress={() => navigation.goBack()} />
        </View>
    );
};

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
    },
    title: {
        fontSize: 24,
        fontWeight: 'bold',
    },
});

export default HomeDetail